package com.caochenlei.graph;

public class EdgeWeightedDigraphTest {
    public static void main(String[] args) {
        EdgeWeightedDigraph EWD = new EdgeWeightedDigraph(8);
        EWD.addEdge(new DirectedEdge(4, 5, 0.35));
        EWD.addEdge(new DirectedEdge(5, 4, 0.35));
        EWD.addEdge(new DirectedEdge(4, 7, 0.37));
        EWD.addEdge(new DirectedEdge(5, 7, 0.28));
        EWD.addEdge(new DirectedEdge(7, 5, 0.28));
        EWD.addEdge(new DirectedEdge(5, 1, 0.32));
        EWD.addEdge(new DirectedEdge(0, 4, 0.38));
        EWD.addEdge(new DirectedEdge(0, 2, 0.26));
        EWD.addEdge(new DirectedEdge(7, 3, 0.39));
        EWD.addEdge(new DirectedEdge(1, 3, 0.29));
        EWD.addEdge(new DirectedEdge(2, 7, 0.34));
        EWD.addEdge(new DirectedEdge(6, 2, 0.40));
        EWD.addEdge(new DirectedEdge(3, 6, 0.52));
        EWD.addEdge(new DirectedEdge(6, 0, 0.58));
        EWD.addEdge(new DirectedEdge(6, 4, 0.93));

        System.out.println("获取EWD的大小：" + EWD.size());
        System.out.println("获取EWD的边数：" + EWD.edge());
        System.out.println("====================");
        for (int v = 0; v < EWD.size(); v++) {
            System.out.println("获取和顶点" + v + "关联的所有边：" + EWD.adj(v));
        }
        System.out.println("====================");
        for (DirectedEdge e : EWD.edges()) {
            System.out.println(e);
        }
    }
}
